<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QListWidget Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QListWidget Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QListWidget class provides an item-based list widget.
<a href="#details">More...</a></p>

<p>Inherits <a href="qlistview.html">QListView</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qlistwidget.html#QListWidget">__init__</a></b> (<i>self</i>, QWidget&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qlistwidget.html#addItem">addItem</a></b> (<i>self</i>, QListWidgetItem&#160;<i>aitem</i>)</li><li><div class="fn" /><b><a href="qlistwidget.html#addItem-2">addItem</a></b> (<i>self</i>, QString&#160;<i>label</i>)</li><li><div class="fn" /><b><a href="qlistwidget.html#addItems">addItems</a></b> (<i>self</i>, QStringList&#160;<i>labels</i>)</li><li><div class="fn" /><b><a href="qlistwidget.html#clear">clear</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qlistwidget.html#closePersistentEditor">closePersistentEditor</a></b> (<i>self</i>, QListWidgetItem&#160;<i>item</i>)</li><li><div class="fn" />int <b><a href="qlistwidget.html#count">count</a></b> (<i>self</i>)</li><li><div class="fn" />QListWidgetItem <b><a href="qlistwidget.html#currentItem">currentItem</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qlistwidget.html#currentRow">currentRow</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qlistwidget.html#dropEvent">dropEvent</a></b> (<i>self</i>, QDropEvent&#160;<i>event</i>)</li><li><div class="fn" />bool <b><a href="qlistwidget.html#dropMimeData">dropMimeData</a></b> (<i>self</i>, int&#160;<i>index</i>, QMimeData&#160;<i>data</i>, Qt.DropAction&#160;<i>action</i>)</li><li><div class="fn" /><b><a href="qlistwidget.html#editItem">editItem</a></b> (<i>self</i>, QListWidgetItem&#160;<i>item</i>)</li><li><div class="fn" />bool <b><a href="qlistwidget.html#event">event</a></b> (<i>self</i>, QEvent&#160;<i>e</i>)</li><li><div class="fn" />list-of-QListWidgetItem <b><a href="qlistwidget.html#findItems">findItems</a></b> (<i>self</i>, QString&#160;<i>text</i>, Qt.MatchFlags&#160;<i>flags</i>)</li><li><div class="fn" />QModelIndex <b><a href="qlistwidget.html#indexFromItem">indexFromItem</a></b> (<i>self</i>, QListWidgetItem&#160;<i>item</i>)</li><li><div class="fn" /><b><a href="qlistwidget.html#insertItem">insertItem</a></b> (<i>self</i>, int&#160;<i>row</i>, QListWidgetItem&#160;<i>item</i>)</li><li><div class="fn" /><b><a href="qlistwidget.html#insertItem-2">insertItem</a></b> (<i>self</i>, int&#160;<i>row</i>, QString&#160;<i>label</i>)</li><li><div class="fn" /><b><a href="qlistwidget.html#insertItems">insertItems</a></b> (<i>self</i>, int&#160;<i>row</i>, QStringList&#160;<i>labels</i>)</li><li><div class="fn" />bool <b><a href="qlistwidget.html#isItemHidden">isItemHidden</a></b> (<i>self</i>, QListWidgetItem&#160;<i>item</i>)</li><li><div class="fn" />bool <b><a href="qlistwidget.html#isItemSelected">isItemSelected</a></b> (<i>self</i>, QListWidgetItem&#160;<i>item</i>)</li><li><div class="fn" />bool <b><a href="qlistwidget.html#isSortingEnabled">isSortingEnabled</a></b> (<i>self</i>)</li><li><div class="fn" />QListWidgetItem <b><a href="qlistwidget.html#item">item</a></b> (<i>self</i>, int&#160;<i>row</i>)</li><li><div class="fn" />QListWidgetItem <b><a href="qlistwidget.html#itemAt">itemAt</a></b> (<i>self</i>, QPoint&#160;<i>p</i>)</li><li><div class="fn" />QListWidgetItem <b><a href="qlistwidget.html#itemAt-2">itemAt</a></b> (<i>self</i>, int&#160;<i>ax</i>, int&#160;<i>ay</i>)</li><li><div class="fn" />QListWidgetItem <b><a href="qlistwidget.html#itemFromIndex">itemFromIndex</a></b> (<i>self</i>, QModelIndex&#160;<i>index</i>)</li><li><div class="fn" />list-of-QListWidgetItem <b><a href="qlistwidget.html#items">items</a></b> (<i>self</i>, QMimeData&#160;<i>data</i>)</li><li><div class="fn" />QWidget <b><a href="qlistwidget.html#itemWidget">itemWidget</a></b> (<i>self</i>, QListWidgetItem&#160;<i>item</i>)</li><li><div class="fn" />QMimeData <b><a href="qlistwidget.html#mimeData">mimeData</a></b> (<i>self</i>, list-of-QListWidgetItem&#160;<i>items</i>)</li><li><div class="fn" />QStringList <b><a href="qlistwidget.html#mimeTypes">mimeTypes</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qlistwidget.html#openPersistentEditor">openPersistentEditor</a></b> (<i>self</i>, QListWidgetItem&#160;<i>item</i>)</li><li><div class="fn" /><b><a href="qlistwidget.html#removeItemWidget">removeItemWidget</a></b> (<i>self</i>, QListWidgetItem&#160;<i>aItem</i>)</li><li><div class="fn" />int <b><a href="qlistwidget.html#row">row</a></b> (<i>self</i>, QListWidgetItem&#160;<i>item</i>)</li><li><div class="fn" /><b><a href="qlistwidget.html#scrollToItem">scrollToItem</a></b> (<i>self</i>, QListWidgetItem&#160;<i>item</i>, QAbstractItemView.ScrollHint&#160;<i>hint</i>&#160;=&#160;QAbstractItemView.EnsureVisible)</li><li><div class="fn" />list-of-QListWidgetItem <b><a href="qlistwidget.html#selectedItems">selectedItems</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qlistwidget.html#setCurrentItem">setCurrentItem</a></b> (<i>self</i>, QListWidgetItem&#160;<i>item</i>)</li><li><div class="fn" /><b><a href="qlistwidget.html#setCurrentItem-2">setCurrentItem</a></b> (<i>self</i>, QListWidgetItem&#160;<i>item</i>, QItemSelectionModel.SelectionFlags&#160;<i>command</i>)</li><li><div class="fn" /><b><a href="qlistwidget.html#setCurrentRow">setCurrentRow</a></b> (<i>self</i>, int&#160;<i>row</i>)</li><li><div class="fn" /><b><a href="qlistwidget.html#setCurrentRow-2">setCurrentRow</a></b> (<i>self</i>, int&#160;<i>row</i>, QItemSelectionModel.SelectionFlags&#160;<i>command</i>)</li><li><div class="fn" /><b><a href="qlistwidget.html#setItemHidden">setItemHidden</a></b> (<i>self</i>, QListWidgetItem&#160;<i>item</i>, bool&#160;<i>hide</i>)</li><li><div class="fn" /><b><a href="qlistwidget.html#setItemSelected">setItemSelected</a></b> (<i>self</i>, QListWidgetItem&#160;<i>item</i>, bool&#160;<i>select</i>)</li><li><div class="fn" /><b><a href="qlistwidget.html#setItemWidget">setItemWidget</a></b> (<i>self</i>, QListWidgetItem&#160;<i>item</i>, QWidget&#160;<i>widget</i>)</li><li><div class="fn" /><b><a href="qlistwidget.html#setSortingEnabled">setSortingEnabled</a></b> (<i>self</i>, bool&#160;<i>enable</i>)</li><li><div class="fn" /><b><a href="qlistwidget.html#sortItems">sortItems</a></b> (<i>self</i>, Qt.SortOrder&#160;<i>order</i>&#160;=&#160;Qt.AscendingOrder)</li><li><div class="fn" />Qt.DropActions <b><a href="qlistwidget.html#supportedDropActions">supportedDropActions</a></b> (<i>self</i>)</li><li><div class="fn" />QListWidgetItem <b><a href="qlistwidget.html#takeItem">takeItem</a></b> (<i>self</i>, int&#160;<i>row</i>)</li><li><div class="fn" />QRect <b><a href="qlistwidget.html#visualItemRect">visualItemRect</a></b> (<i>self</i>, QListWidgetItem&#160;<i>item</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" /> <b><a href="qlistwidget.html#__len__">__len__</a></b> (<i>self</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qlistwidget.html#currentItemChanged">currentItemChanged</a></b> (QListWidgetItem *,QListWidgetItem *)</li><li><div class="fn" />void <b><a href="qlistwidget.html#currentRowChanged">currentRowChanged</a></b> (int)</li><li><div class="fn" />void <b><a href="qlistwidget.html#currentTextChanged">currentTextChanged</a></b> (const QString&amp;)</li><li><div class="fn" />void <b><a href="qlistwidget.html#itemActivated">itemActivated</a></b> (QListWidgetItem *)</li><li><div class="fn" />void <b><a href="qlistwidget.html#itemChanged">itemChanged</a></b> (QListWidgetItem *)</li><li><div class="fn" />void <b><a href="qlistwidget.html#itemClicked">itemClicked</a></b> (QListWidgetItem *)</li><li><div class="fn" />void <b><a href="qlistwidget.html#itemDoubleClicked">itemDoubleClicked</a></b> (QListWidgetItem *)</li><li><div class="fn" />void <b><a href="qlistwidget.html#itemEntered">itemEntered</a></b> (QListWidgetItem *)</li><li><div class="fn" />void <b><a href="qlistwidget.html#itemPressed">itemPressed</a></b> (QListWidgetItem *)</li><li><div class="fn" />void <b><a href="qlistwidget.html#itemSelectionChanged">itemSelectionChanged</a></b> ()</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QListWidget class provides an item-based list widget.</p>
<p>QListWidget is a convenience class that provides a list view
similar to the one supplied by <a href="qlistview.html">QListView</a>, but with a classic item-based
interface for adding and removing items. QListWidget uses an
internal model to manage each <a href="qlistwidgetitem.html">QListWidgetItem</a> in the list.</p>
<p>For a more flexible list view widget, use the <a href="qlistview.html">QListView</a> class with a standard model.</p>
<p>List widgets are constructed in the same way as other
widgets:</p>
<pre class="cpp">
     QListWidget *listWidget = new QListWidget(this);
</pre>
<p>The <a href="qabstractitemview.html#selectionMode-prop">selectionMode</a>() of
a list widget determines how many of the items in the list can be
selected at the same time, and whether complex selections of items
can be created. This can be set with the <a href="qabstractitemview.html#selectionMode-prop">setSelectionMode</a>()
function.</p>
<p>There are two ways to add items to the list: they can be
constructed with the list widget as their parent widget, or they
can be constructed with no parent widget and added to the list
later. If a list widget already exists when the items are
constructed, the first method is easier to use:</p>
<pre class="cpp">
     <span class="keyword">new</span> <span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span>(tr(<span class="string">"Oak"</span>)<span class="operator">,</span> listWidget);
     <span class="keyword">new</span> <span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span>(tr(<span class="string">"Fir"</span>)<span class="operator">,</span> listWidget);
     <span class="keyword">new</span> <span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span>(tr(<span class="string">"Pine"</span>)<span class="operator">,</span> listWidget);
</pre>
<p>If you need to insert a new item into the list at a particular
position, then it should be constructed without a parent widget.
The <a href="qlistwidget.html#insertItem">insertItem</a>() function
should then be used to place it within the list. The list widget
will take ownership of the item.</p>
<pre class="cpp">
     <span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span> <span class="operator">*</span>newItem <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlistwidgetitem.html">QListWidgetItem</a></span>;
     newItem<span class="operator">-</span><span class="operator">&gt;</span>setText(itemText);
     listWidget<span class="operator">-</span><span class="operator">&gt;</span>insertItem(row<span class="operator">,</span> newItem);
</pre>
<p>For multiple items, <a href="qlistwidget.html#insertItems">insertItems</a>() can be used
instead. The number of items in the list is found with the <a href="qlistwidget.html#count-prop">count</a>() function. To remove items
from the list, use <a href="qlistwidget.html#takeItem">takeItem</a>().</p>
<p>The current item in the list can be found with <a href="qlistwidget.html#currentItem">currentItem</a>(), and changed with
<a href="qlistwidget.html#setCurrentItem">setCurrentItem</a>(). The
user can also change the current item by navigating with the
keyboard or clicking on a different item. When the current item
changes, the <a href="qlistwidget.html#currentItemChanged">currentItemChanged</a>()
signal is emitted with the new current item and the item that was
previously current.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img alt="Screenshot of a Windows XP style list widget" src="images/windowsxp-listview.png" /></td>
<td><img alt="Screenshot of a Macintosh style table widget" src="images/macintosh-listview.png" /></td>
<td><img alt="Screenshot of a Plastique style table widget" src="images/plastique-listview.png" /></td>
</tr>
<tr class="even" valign="top">
<td>A <a href="gallery-windowsxp.html">Windows XP style</a> list
widget.</td>
<td>A <a href="gallery-macintosh.html">Macintosh style</a> list
widget.</td>
<td>A <a href="gallery-plastique.html">Plastique style</a> list
widget.</td>
</tr>
</table>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QListWidget" />QListWidget.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs an empty <a href="qlistwidget.html">QListWidget</a>
with the given <i>parent</i>.</p>


<h3 class="fn"><a name="addItem" />QListWidget.addItem (<i>self</i>, <a href="qlistwidgetitem.html">QListWidgetItem</a>&#160;<i>aitem</i>)</h3><p>The <i>aitem</i> argument has it's ownership transferred to Qt.</p><p>Inserts an item with the text <i>label</i> at the end of the
list widget.</p>


<h3 class="fn"><a name="addItem-2" />QListWidget.addItem (<i>self</i>, QString&#160;<i>label</i>)</h3><p>Inserts the <i>item</i> at the end of the list widget.</p>
<p><b>Warning:</b> A <a href="qlistwidgetitem.html">QListWidgetItem</a> can only be added to a
<a href="qlistwidget.html">QListWidget</a> once. Adding the same
<a href="qlistwidgetitem.html">QListWidgetItem</a> multiple times
to a <a href="qlistwidget.html">QListWidget</a> will result in
undefined behavior.</p>
<p><b>See also</b> <a href="qlistwidget.html#insertItem">insertItem</a>().</p>


<h3 class="fn"><a name="addItems" />QListWidget.addItems (<i>self</i>, QStringList&#160;<i>labels</i>)</h3><p>Inserts items with the text <i>labels</i> at the end of the list
widget.</p>
<p><b>See also</b> <a href="qlistwidget.html#insertItems">insertItems</a>().</p>


<h3 class="fn"><a name="clear" />QListWidget.clear (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void clear()</tt>.</p><p>Removes all items and selections in the view.</p>
<p><b>Warning:</b> All items will be permanently deleted.</p>


<h3 class="fn"><a name="closePersistentEditor" />QListWidget.closePersistentEditor (<i>self</i>, <a href="qlistwidgetitem.html">QListWidgetItem</a>&#160;<i>item</i>)</h3><p>Closes the persistent editor for the given <i>item</i>.</p>
<p><b>See also</b> <a href="qlistwidget.html#openPersistentEditor">openPersistentEditor</a>().</p>


<h3 class="fn"><a name="count" />int QListWidget.count (<i>self</i>)</h3><h3 class="fn"><a name="currentItem" /><a href="qlistwidgetitem.html">QListWidgetItem</a> QListWidget.currentItem (<i>self</i>)</h3><p>Returns the current item.</p>
<p><b>See also</b> <a href="qlistwidget.html#setCurrentItem">setCurrentItem</a>().</p>


<h3 class="fn"><a name="currentRow" />int QListWidget.currentRow (<i>self</i>)</h3><h3 class="fn"><a name="dropEvent" />QListWidget.dropEvent (<i>self</i>, <a href="qdropevent.html">QDropEvent</a>&#160;<i>event</i>)</h3><p>Reimplemented from <a href="qwidget.html#dropEvent">QWidget.dropEvent</a>().</p>


<h3 class="fn"><a name="dropMimeData" />bool QListWidget.dropMimeData (<i>self</i>, int&#160;<i>index</i>, <a href="qmimedata.html">QMimeData</a>&#160;<i>data</i>, <a href="qt.html#DropAction-enum">Qt.DropAction</a>&#160;<i>action</i>)</h3><p>Handles <i>data</i> supplied by an external drag and drop
operation that ended with the given <i>action</i> in the given
<i>index</i>. Returns true if <i>data</i> and <i>action</i> can be
handled by the model; otherwise returns false.</p>
<p><b>See also</b> <a href="qlistwidget.html#supportedDropActions">supportedDropActions</a>().</p>


<h3 class="fn"><a name="editItem" />QListWidget.editItem (<i>self</i>, <a href="qlistwidgetitem.html">QListWidgetItem</a>&#160;<i>item</i>)</h3><p>Starts editing the <i>item</i> if it is editable.</p>


<h3 class="fn"><a name="event" />bool QListWidget.event (<i>self</i>, <a href="qevent.html">QEvent</a>&#160;<i>e</i>)</h3><p>Reimplemented from <a href="qobject.html#event">QObject.event</a>().</p>


<h3 class="fn"><a name="findItems" />list-of-QListWidgetItem QListWidget.findItems (<i>self</i>, QString&#160;<i>text</i>, <a href="qt-matchflags.html">Qt.MatchFlags</a>&#160;<i>flags</i>)</h3><p>Finds items with the text that matches the string <i>text</i>
using the given <i>flags</i>.</p>


<h3 class="fn"><a name="indexFromItem" /><a href="qmodelindex.html">QModelIndex</a> QListWidget.indexFromItem (<i>self</i>, <a href="qlistwidgetitem.html">QListWidgetItem</a>&#160;<i>item</i>)</h3><p>Returns the <a href="qmodelindex.html">QModelIndex</a> assocated
with the given <i>item</i>.</p>


<h3 class="fn"><a name="insertItem" />QListWidget.insertItem (<i>self</i>, int&#160;<i>row</i>, <a href="qlistwidgetitem.html">QListWidgetItem</a>&#160;<i>item</i>)</h3><p>The <i>item</i> argument has it's ownership transferred to Qt.</p><p>Inserts the <i>item</i> at the position in the list given by
<i>row</i>.</p>
<p><b>See also</b> <a href="qlistwidget.html#addItem">addItem</a>().</p>


<h3 class="fn"><a name="insertItem-2" />QListWidget.insertItem (<i>self</i>, int&#160;<i>row</i>, QString&#160;<i>label</i>)</h3><p>Inserts an item with the text <i>label</i> in the list widget at
the position given by <i>row</i>.</p>
<p><b>See also</b> <a href="qlistwidget.html#addItem">addItem</a>().</p>


<h3 class="fn"><a name="insertItems" />QListWidget.insertItems (<i>self</i>, int&#160;<i>row</i>, QStringList&#160;<i>labels</i>)</h3><p>Inserts items from the list of <i>labels</i> into the list,
starting at the given <i>row</i>.</p>
<p><b>See also</b> <a href="qlistwidget.html#insertItem">insertItem</a>() and <a href="qlistwidget.html#addItem">addItem</a>().</p>


<h3 class="fn"><a name="isItemHidden" />bool QListWidget.isItemHidden (<i>self</i>, <a href="qlistwidgetitem.html">QListWidgetItem</a>&#160;<i>item</i>)</h3><h3 class="fn"><a name="isItemSelected" />bool QListWidget.isItemSelected (<i>self</i>, <a href="qlistwidgetitem.html">QListWidgetItem</a>&#160;<i>item</i>)</h3><h3 class="fn"><a name="isSortingEnabled" />bool QListWidget.isSortingEnabled (<i>self</i>)</h3><h3 class="fn"><a name="item" /><a href="qlistwidgetitem.html">QListWidgetItem</a> QListWidget.item (<i>self</i>, int&#160;<i>row</i>)</h3><p>Returns the item that occupies the given <i>row</i> in the list
if one has been set; otherwise returns 0.</p>
<p><b>See also</b> <a href="qlistwidget.html#row">row</a>().</p>


<h3 class="fn"><a name="itemAt" /><a href="qlistwidgetitem.html">QListWidgetItem</a> QListWidget.itemAt (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>p</i>)</h3><p>Returns a pointer to the item at the coordinates <i>p</i>. The
coordinates are relative to the list widget's <a href="qabstractscrollarea.html#viewport">viewport()</a>.</p>


<h3 class="fn"><a name="itemAt-2" /><a href="qlistwidgetitem.html">QListWidgetItem</a> QListWidget.itemAt (<i>self</i>, int&#160;<i>ax</i>, int&#160;<i>ay</i>)</h3><p>This is an overloaded function.</p>
<p>Returns a pointer to the item at the coordinates (<i>x</i>,
<i>y</i>). The coordinates are relative to the list widget's
<a href="qabstractscrollarea.html#viewport">viewport()</a>.</p>


<h3 class="fn"><a name="itemFromIndex" /><a href="qlistwidgetitem.html">QListWidgetItem</a> QListWidget.itemFromIndex (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>index</i>)</h3><p>Returns a pointer to the <a href="qlistwidgetitem.html">QListWidgetItem</a> assocated with the given
<i>index</i>.</p>


<h3 class="fn"><a name="items" />list-of-QListWidgetItem QListWidget.items (<i>self</i>, <a href="qmimedata.html">QMimeData</a>&#160;<i>data</i>)</h3><p>Returns a list of pointers to the items contained in the
<i>data</i> object. If the object was not created by a <a href="qlistwidget.html">QListWidget</a> in the same process, the list is
empty.</p>


<h3 class="fn"><a name="itemWidget" /><a href="qwidget.html">QWidget</a> QListWidget.itemWidget (<i>self</i>, <a href="qlistwidgetitem.html">QListWidgetItem</a>&#160;<i>item</i>)</h3><p>Returns the widget displayed in the given <i>item</i>.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also</b> <a href="qlistwidget.html#setItemWidget">setItemWidget</a>().</p>


<h3 class="fn"><a name="mimeData" /><a href="qmimedata.html">QMimeData</a> QListWidget.mimeData (<i>self</i>, list-of-QListWidgetItem&#160;<i>items</i>)</h3><p>The <i>QMimeData</i> result</p><p>Returns an object that contains a serialized description of the
specified <i>items</i>. The format used to describe the items is
obtained from the <a href="qlistwidget.html#mimeTypes">mimeTypes</a>() function.</p>
<p>If the list of items is empty, 0 is returned instead of a
serialized empty list.</p>


<h3 class="fn"><a name="mimeTypes" />QStringList QListWidget.mimeTypes (<i>self</i>)</h3><p>Returns a list of MIME types that can be used to describe a list
of listwidget items.</p>
<p><b>See also</b> <a href="qlistwidget.html#mimeData">mimeData</a>().</p>


<h3 class="fn"><a name="openPersistentEditor" />QListWidget.openPersistentEditor (<i>self</i>, <a href="qlistwidgetitem.html">QListWidgetItem</a>&#160;<i>item</i>)</h3><p>Opens an editor for the given <i>item</i>. The editor remains
open after editing.</p>
<p><b>See also</b> <a href="qlistwidget.html#closePersistentEditor">closePersistentEditor</a>().</p>


<h3 class="fn"><a name="removeItemWidget" />QListWidget.removeItemWidget (<i>self</i>, <a href="qlistwidgetitem.html">QListWidgetItem</a>&#160;<i>aItem</i>)</h3><p>Removes the widget set on the given <i>item</i>.</p>
<p>This function was introduced in Qt 4.3.</p>


<h3 class="fn"><a name="row" />int QListWidget.row (<i>self</i>, <a href="qlistwidgetitem.html">QListWidgetItem</a>&#160;<i>item</i>)</h3><p>Returns the row containing the given <i>item</i>.</p>
<p><b>See also</b> <a href="qlistwidget.html#item">item</a>().</p>


<h3 class="fn"><a name="scrollToItem" />QListWidget.scrollToItem (<i>self</i>, <a href="qlistwidgetitem.html">QListWidgetItem</a>&#160;<i>item</i>, <a href="qabstractitemview.html#ScrollHint-enum">QAbstractItemView.ScrollHint</a>&#160;<i>hint</i>&#160;=&#160;QAbstractItemView.EnsureVisible)</h3><p>This method is also a Qt slot with the C++ signature <tt>void scrollToItem(const QListWidgetItem *,QAbstractItemView::ScrollHint = QAbstractItemView.EnsureVisible)</tt>.</p><p>Scrolls the view if necessary to ensure that the <i>item</i> is
visible.</p>
<p><i>hint</i> specifies where the <i>item</i> should be located
after the operation.</p>


<h3 class="fn"><a name="selectedItems" />list-of-QListWidgetItem QListWidget.selectedItems (<i>self</i>)</h3><p>Returns a list of all selected items in the list widget.</p>


<h3 class="fn"><a name="setCurrentItem" />QListWidget.setCurrentItem (<i>self</i>, <a href="qlistwidgetitem.html">QListWidgetItem</a>&#160;<i>item</i>)</h3><p>Sets the current item to <i>item</i>.</p>
<p>Unless the selection mode is <a href="qabstractitemview.html#SelectionMode-enum">NoSelection</a>, the
item is also be selected.</p>
<p><b>See also</b> <a href="qlistwidget.html#currentItem">currentItem</a>().</p>


<h3 class="fn"><a name="setCurrentItem-2" />QListWidget.setCurrentItem (<i>self</i>, <a href="qlistwidgetitem.html">QListWidgetItem</a>&#160;<i>item</i>, <a href="qitemselectionmodel-selectionflags.html">QItemSelectionModel.SelectionFlags</a>&#160;<i>command</i>)</h3><p>Set the current item to <i>item</i>, using the given
<i>command</i>.</p>
<p>This function was introduced in Qt 4.4.</p>


<h3 class="fn"><a name="setCurrentRow" />QListWidget.setCurrentRow (<i>self</i>, int&#160;<i>row</i>)</h3><h3 class="fn"><a name="setCurrentRow-2" />QListWidget.setCurrentRow (<i>self</i>, int&#160;<i>row</i>, <a href="qitemselectionmodel-selectionflags.html">QItemSelectionModel.SelectionFlags</a>&#160;<i>command</i>)</h3><h3 class="fn"><a name="setItemHidden" />QListWidget.setItemHidden (<i>self</i>, <a href="qlistwidgetitem.html">QListWidgetItem</a>&#160;<i>item</i>, bool&#160;<i>hide</i>)</h3><h3 class="fn"><a name="setItemSelected" />QListWidget.setItemSelected (<i>self</i>, <a href="qlistwidgetitem.html">QListWidgetItem</a>&#160;<i>item</i>, bool&#160;<i>select</i>)</h3><h3 class="fn"><a name="setItemWidget" />QListWidget.setItemWidget (<i>self</i>, <a href="qlistwidgetitem.html">QListWidgetItem</a>&#160;<i>item</i>, <a href="qwidget.html">QWidget</a>&#160;<i>widget</i>)</h3><p>The <i>widget</i> argument has it's ownership transferred to Qt.</p><p>Sets the <i>widget</i> to be displayed in the give
<i>item</i>.</p>
<p>This function should only be used to display static content in
the place of a list widget item. If you want to display custom
dynamic content or implement a custom editor widget, use <a href="qlistview.html">QListView</a> and subclass <a href="qitemdelegate.html">QItemDelegate</a> instead.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also</b> <a href="qlistwidget.html#itemWidget">itemWidget</a>() and <a href="model-view-programming.html#delegate-classes">Delegate
Classes</a>.</p>


<h3 class="fn"><a name="setSortingEnabled" />QListWidget.setSortingEnabled (<i>self</i>, bool&#160;<i>enable</i>)</h3><h3 class="fn"><a name="sortItems" />QListWidget.sortItems (<i>self</i>, <a href="qt.html#SortOrder-enum">Qt.SortOrder</a>&#160;<i>order</i>&#160;=&#160;Qt.AscendingOrder)</h3><p>Sorts all the items in the list widget according to the
specified <i>order</i>.</p>


<h3 class="fn"><a name="supportedDropActions" /><a href="qt-dropactions.html">Qt.DropActions</a> QListWidget.supportedDropActions (<i>self</i>)</h3><p>Returns the drop actions supported by this view.</p>
<p><b>See also</b> <a href="qt.html#DropAction-enum">Qt.DropActions</a>.</p>


<h3 class="fn"><a name="takeItem" /><a href="qlistwidgetitem.html">QListWidgetItem</a> QListWidget.takeItem (<i>self</i>, int&#160;<i>row</i>)</h3><p>The <i>QListWidgetItem</i> result</p><p>Removes and returns the item from the given <i>row</i> in the
list widget; otherwise returns 0.</p>
<p>Items removed from a list widget will not be managed by Qt, and
will need to be deleted manually.</p>
<p><b>See also</b> <a href="qlistwidget.html#insertItem">insertItem</a>() and <a href="qlistwidget.html#addItem">addItem</a>().</p>


<h3 class="fn"><a name="visualItemRect" /><a href="qrect.html">QRect</a> QListWidget.visualItemRect (<i>self</i>, <a href="qlistwidgetitem.html">QListWidgetItem</a>&#160;<i>item</i>)</h3><p>Returns the rectangle on the viewport occupied by the item at
<i>item</i>.</p>
<h3 class="fn"><a name="__len__" /> QListWidget.__len__ (<i>self</i>)</h3><hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="currentItemChanged" />void currentItemChanged (QListWidgetItem *,QListWidgetItem *)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the current item changes.</p>
<p><i>previous</i> is the item that previously had the focus;
<i>current</i> is the new current item.</p>


<h3 class="fn"><a name="currentRowChanged" />void currentRowChanged (int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the current item changes.</p>
<p><i>currentRow</i> is the row of the current item. If there is no
current item, the <i>currentRow</i> is -1.</p>


<h3 class="fn"><a name="currentTextChanged" />void currentTextChanged (const QString&amp;)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the current item changes.</p>
<p><i>currentText</i> is the text data in the current item. If
there is no current item, the <i>currentText</i> is invalid.</p>


<h3 class="fn"><a name="itemActivated" />void itemActivated (QListWidgetItem *)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the <i>item</i> is activated. The
<i>item</i> is activated when the user clicks or double clicks on
it, depending on the system configuration. It is also activated
when the user presses the activation key (on Windows and X11 this
is the <b>Return</b> key, on Mac OS X it is <b>Ctrl+0</b>).</p>


<h3 class="fn"><a name="itemChanged" />void itemChanged (QListWidgetItem *)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the data of <i>item</i> has
changed.</p>


<h3 class="fn"><a name="itemClicked" />void itemClicked (QListWidgetItem *)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted with the specified <i>item</i> when a
mouse button is clicked on an item in the widget.</p>
<p><b>See also</b> <a href="qlistwidget.html#itemPressed">itemPressed</a>() and <a href="qlistwidget.html#itemDoubleClicked">itemDoubleClicked</a>().</p>


<h3 class="fn"><a name="itemDoubleClicked" />void itemDoubleClicked (QListWidgetItem *)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted with the specified <i>item</i> when a
mouse button is double clicked on an item in the widget.</p>
<p><b>See also</b> <a href="qlistwidget.html#itemClicked">itemClicked</a>() and <a href="qlistwidget.html#itemPressed">itemPressed</a>().</p>


<h3 class="fn"><a name="itemEntered" />void itemEntered (QListWidgetItem *)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the mouse cursor enters an item. The
<i>item</i> is the item entered. This signal is only emitted when
<a href="qwidget.html#mouseTracking-prop">mouseTracking</a> is
turned on, or when a mouse button is pressed while moving into an
item.</p>
<p><b>See also</b> <a href="qwidget.html#mouseTracking-prop">QWidget.setMouseTracking</a>().</p>


<h3 class="fn"><a name="itemPressed" />void itemPressed (QListWidgetItem *)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted with the specified <i>item</i> when a
mouse button is pressed on an item in the widget.</p>
<p><b>See also</b> <a href="qlistwidget.html#itemClicked">itemClicked</a>() and <a href="qlistwidget.html#itemDoubleClicked">itemDoubleClicked</a>().</p>


<h3 class="fn"><a name="itemSelectionChanged" />void itemSelectionChanged ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the selection changes.</p>
<p><b>See also</b> <a href="qlistwidget.html#selectedItems">selectedItems</a>(), <a href="qlistwidgetitem.html#isSelected">QListWidgetItem.isSelected</a>(),
and <a href="qlistwidget.html#currentItemChanged">currentItemChanged</a>().</p>


<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.8.0</td></tr></table></div></address></body></html>